<!-- 地址组件 -->
<template>
  <div
    :style="{
      'background-color': config.ConfigData.bgcolor,
      margin: '0 ' + config.ConfigData.margin + 'px',
      'border-radius': config.ConfigData.parentradius + 'px',
      padding: '0 ' + config.ConfigData.padding + 'px'
    }"
  >
    <div class="mapview">
      <div class="mapcontent">
        <div class="maptitle" :style="{ color: config.ConfigData.titlecolor }">
          {{ subStr(config.ConfigData.title, 30) }}
        </div>
        <div class="mapdesc" :style="{ color: config.ConfigData.contentcolor }">
          {{ subStr(config.ConfigData.address, 84) }}
        </div>
      </div>
      <div class="mapicon">
        <i class="iconfont icon-daohang"></i>
      </div>
    </div>
  </div>
</template>

<script>
import { isReallyNull } from "@/utils/utils";

export default {
  name: "MapCopt",
  props: {
    config: Object
  },
  data() {
    return {};
  },
  methods: {
    nav() {
      if (
        isReallyNull(this.config.ConfigData.latlng.lat) ||
        isReallyNull(this.config.ConfigData.latlng.lng)
      ) {
        return;
      }
      // wepy.openLocation({
      //   latitude: this.config.ConfigData.latlng.lat, // 纬度，范围为-90~90，负数表示南纬,
      //   longitude: this.config.ConfigData.latlng.lng, // 经度，范围为-180~180，负数表示西经,
      //   scale: 15, // 缩放比例，范围5~18,
      //   name: this.config.ConfigData.title, // 位置名,
      //   address: this.config.ConfigData.address // 地址的详细说明,
      // });
    }
  },
  mounted() {}
};
</script>

<style lang="scss">
.mapview {
  height: 76.5px;
  margin: 0 5px;
  padding: 0 5px;
  background: transparent;
  // border: 1px solid rgba(234, 234, 234, 1);
  box-shadow: 0px 1.5px 5px 0px rgba(122, 122, 122, 0.08);
  border-radius: 3.5px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  .mapcontent {
    display: flex;
    flex-direction: column;
    .maptitle {
      font-size: 17px;
      font-family: "PingFang-SC-Medium";
      font-weight: 500;
      color: rgba(34, 34, 34, 1);
    }
    .mapdesc {
      width: 255px;
      margin-top: 10px;
      font-size: 12px;
      font-family: "PingFang-SC-Medium";
      font-weight: 500;
      color: rgba(153, 153, 153, 1);
    }
  }
  .mapicon {
    width: 35px;
    height: 35px;
    background: #3cb035;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    i {
      font-size: 15px;
      color: #ffffff;
    }
  }
}
</style>
